using System;
using System.Collections.Generic;

namespace PKGames
{
	public class PluginiOS : PluginNative
	{
		protected void CallAsyncStaticMethod(Action<string[]> method, Action<string> successAction, Action<string> errorAction, params string[] args)
		{
			string name = method.Method.Name;
			string callbackObjectName = CreateCallbackObject(name, successAction, errorAction);
			string[] arg = PrependCallbackInfo(callbackObjectName, args);
			method.Fire(arg);
		}

		private string[] PrependCallbackInfo(string callbackObjectName, string[] args)
		{
			List<string> list = new List<string>(args);
			list.Insert(0, "OnError");
			list.Insert(0, "OnSuccess");
			list.Insert(0, callbackObjectName);
			return list.ToArray();
		}
	}
}
